package com.zhledu.mapreduce.college;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class CollegeMapper  extends Mapper<LongWritable, Text, Text, LongWritable> {
    @Override
    protected void map(LongWritable key, Text value, Mapper<LongWritable, Text, Text, LongWritable>.Context context) throws IOException, InterruptedException {
   //某一行数据
   //value={'iid': 8416, 'serialNumber': 1, 'schoolName': '北京大学', 'schoolIDcode': '4111010001', 'competentdepartment': '教育部', 'local': '北京市', 'level': '本科', 'remark': None, 'area': '北京', 'type': 1}
    String departName=value.toString().split(",")[4].split(":")[1].replace("'","");
    context.write(new Text(departName),new LongWritable(1));
    //教育部：【1，1，1，1，1】
    }
}
